{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "persistent-union",
   "metadata": {},
   "outputs": [],
   "source": [
    "import json\n",
    "import os"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "normal-peace",
   "metadata": {},
   "outputs": [],
   "source": [
    "def get_json_data_from_file_name(file_name):\n",
    "    # zong_data_json_utf8.json\n",
    "    if \".json\" not in file_name:\n",
    "        return 1/0\n",
    "    temp_file_name = file_name\n",
    "    temp_json_str = \"\"\n",
    "    with open(\"./{}\".format(temp_file_name),\"r\",encoding='utf-8') as f:\n",
    "        temp_json_str = f.readline()\n",
    "    temp_json_data = json.loads(temp_json_str)\n",
    "    return temp_json_data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "entitled-modem",
   "metadata": {},
   "outputs": [],
   "source": [
    "zong_data_json = get_json_data_from_file_name(\"zong_data_json_utf8.json\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "critical-google",
   "metadata": {},
   "source": [
    "## 单词"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "polish-armor",
   "metadata": {},
   "source": [
    "<font style=\"color:green;font-weight:bold;font-size:20px\">transport</font><br><font style=\"color:#808080\">[ˈtrænspɔːt]</font>  <font style=\"color:#808080\">[trænsˈpɔːt]</font>  <br>❶ <font style=\"color:#000000;font-weight:bold\">n. 运输，运送；交通工具</font><br>❷ <font style=\"color:#000000;font-weight:bold\">v. 运输，运送</font><hr style=\"FILTER:alpha(opacity=100,finishopacity=0,style=1)\" color=#33FF00 SIZE=2>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "hearing-figure",
   "metadata": {},
   "outputs": [],
   "source": [
    "def get_html_main_from_main_sx(main_sx):\n",
    "    temp_main_sx = main_sx\n",
    "    \n",
    "    bq_num_1 = '❶❷❸❹❺❻❼❽❾❿⓫⓬⓭⓮⓯⓰⓱⓲⓳⓴'\n",
    "    \n",
    "    # 单词\n",
    "    html_str = '<font style=\"color:green;font-weight:bold;font-size:20px\">'\n",
    "    html_str += main_sx[\"wordName\"]\n",
    "    html_str += '</font><br>'\n",
    "    \n",
    "    # 音标\n",
    "    enSymbols_list = main_sx['enSymbols_list']\n",
    "    enSymbols_list_len = len(enSymbols_list)\n",
    "    for i in range(enSymbols_list_len):\n",
    "        html_str += '<font style=\"color:#808080\">'\n",
    "        html_str += enSymbols_list[i]\n",
    "        html_str += '</font>  '\n",
    "    html_str += '<br>'\n",
    "    \n",
    "    # 意思\n",
    "    means_list = main_sx['means_list']\n",
    "    means_list_len = len(means_list)\n",
    "    for i in range(means_list_len):\n",
    "        html_str += bq_num_1[i]\n",
    "        html_str += ' <font style=\"color:#000000;font-weight:bold\">'\n",
    "        html_str += means_list[i]\n",
    "        html_str += '</font>'\n",
    "        if i!=means_list_len-1:\n",
    "            html_str += '<br>'\n",
    "    html_str += '<hr style=\"FILTER:alpha(opacity=100,finishopacity=0,style=1)\" color=#33FF00 SIZE=2>'\n",
    "    \n",
    "    return html_str"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "green-amber",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'<font style=\"color:green;font-weight:bold;font-size:20px\">transport</font><br><font style=\"color:#808080\">[ˈtrænspɔːt]</font>  <font style=\"color:#808080\">[trænsˈpɔːt]</font>  <br>❶ <font style=\"color:#000000;font-weight:bold\">n. 运输，运送；交通工具</font><br>❷ <font style=\"color:#000000;font-weight:bold\">v. 运输，运送</font><hr style=\"FILTER:alpha(opacity=100,finishopacity=0,style=1)\" color=#33FF00 SIZE=2>'"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "get_html_main_from_main_sx(zong_data_json[\"transport\"][\"main_sx\"])"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "underlying-neighbor",
   "metadata": {},
   "source": [
    "<font style=\"color:green;font-weight:bold;font-size:20px\">transport</font><br><font style=\"color:#808080\">[ˈtrænspɔːt]</font>  <font style=\"color:#808080\">[trænsˈpɔːt]</font>  <br>❶ <font style=\"color:#000000;font-weight:bold\">n. 运输，运送；交通工具</font><br>❷ <font style=\"color:#000000;font-weight:bold\">v. 运输，运送</font><hr style=\"FILTER:alpha(opacity=100,finishopacity=0,style=1)\" color=#987cb9 SIZE=10>"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "floral-cocktail",
   "metadata": {},
   "source": [
    "## 考点"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "concrete-amsterdam",
   "metadata": {},
   "source": [
    "<font style=\"color:green;font-weight:bold\">考点:</font><br>① <font style=\"color:#000000\">the European Union</font><br><font style=\"color:#000000\"><u>欧盟</u></font> <font style=\"color:#808080\">(2011英语二阅读)</font><br>② <font style=\"color:#000000\">the European Union</font><br><font style=\"color:#000000\"><u>欧盟</u></font> <font style=\"color:#808080\">(2011英语二阅读)</font><br>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "proud-dependence",
   "metadata": {},
   "outputs": [],
   "source": [
    "def get_html_other_from_other_sx_exams_list(exams_list):\n",
    "    temp_exams_list = exams_list\n",
    "    \n",
    "    bq_num_2 = '①②③④⑤⑥⑦⑧⑨⑩⑪⑫⑬⑭⑮⑯⑰⑱⑲⑳'\n",
    "    \n",
    "    # 标题\n",
    "    html_str = '<font style=\"color:green;font-weight:bold\">考点:</font><br>'\n",
    "    \n",
    "    temp_exams_list_len = len(temp_exams_list)\n",
    "    for i in range(temp_exams_list_len):\n",
    "        html_str += bq_num_2[i]\n",
    "        html_str += ' <font style=\"color:#000000\">'\n",
    "        html_str += temp_exams_list[i][0]\n",
    "        html_str += '</font><br><font style=\"color:#000000\"><u>'\n",
    "        html_str += temp_exams_list[i][1]\n",
    "        html_str += '</u></font> <font style=\"color:#808080\">('\n",
    "        html_str += temp_exams_list[i][2]\n",
    "        html_str += ')</font><br>'\n",
    "    \n",
    "    return html_str"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "derived-square",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'<font style=\"color:green;font-weight:bold\">考点:</font><br>① <font style=\"color:#000000\">to help expand user traffic</font><br><font style=\"color:#000000\"><u>帮助增加用户访问量</u></font> <font style=\"color:#808080\">(2011英语一阅读)</font><br>'"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "get_html_other_from_other_sx_exams_list(zong_data_json[\"traffic\"][\"other_sx\"][\"exams_list\"])"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "extreme-miller",
   "metadata": {},
   "source": [
    "<font style=\"color:green;font-weight:bold\">考点:</font><br>① <font style=\"color:#000000\">to help expand user traffic</font><br><font style=\"color:#000000\"><u>帮助增加用户访问量</u></font> <font style=\"color:#808080\">(2011英语一阅读)</font><br>"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "stuffed-sphere",
   "metadata": {},
   "source": [
    "## 例句"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "female-performance",
   "metadata": {},
   "source": [
    "<font style=\"color:green;font-weight:bold\">例句:</font><br>① <font style=\"color:#000000\">It is worth the endeavor. </font><br><font style=\"color:#000000\"><u>值得尝试。</u></font> <font style=\"color:#808080\">(2018英语二完型)</font><br>② <font style=\"color:#000000\">Good governance rests on an understanding of the inherentworth of each individual.</font><br><font style=\"color:#000000\"><u>善治在于把握每个人的内在价值。</u></font> <font style=\"color:#808080\">(2017英语一阅读)</font><br>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "purple-juice",
   "metadata": {},
   "outputs": [],
   "source": [
    "def get_html_other_from_other_sx_examples_list(examples_list):\n",
    "    temp_examples_list = examples_list\n",
    "    \n",
    "    bq_num_2 = '①②③④⑤⑥⑦⑧⑨⑩⑪⑫⑬⑭⑮⑯⑰⑱⑲⑳'\n",
    "    \n",
    "    # 标题\n",
    "    html_str = '<font style=\"color:green;font-weight:bold\">例句:</font><br>'\n",
    "    \n",
    "    temp_examples_list_len = len(temp_examples_list)\n",
    "    for i in range(temp_examples_list_len):\n",
    "        html_str += bq_num_2[i]\n",
    "        html_str += ' <font style=\"color:#000000\">'\n",
    "        html_str += temp_examples_list[i][0]\n",
    "        html_str += '</font><br><font style=\"color:#000000\"><u>'\n",
    "        html_str += temp_examples_list[i][1]\n",
    "        html_str += '</u></font> <font style=\"color:#808080\">'\n",
    "        html_str += temp_examples_list[i][2]\n",
    "        html_str += '</font><br>'\n",
    "    \n",
    "    return html_str"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "civic-latino",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'<font style=\"color:green;font-weight:bold\">例句:</font><br>① <font style=\"color:#000000\">It is worth the endeavor. </font><br><font style=\"color:#000000\"><u>值得尝试。</u></font> <font style=\"color:#808080\">(2018英语二完型)</font><br>② <font style=\"color:#000000\">Good governance rests on an understanding of the inherentworth of each individual.</font><br><font style=\"color:#000000\"><u>善治在于把握每个人的内在价值。</u></font> <font style=\"color:#808080\">(2017英语一阅读)</font><br>'"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "get_html_other_from_other_sx_examples_list(zong_data_json[\"worthy\"][\"other_sx\"][\"examples_list\"])"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "frozen-galaxy",
   "metadata": {},
   "source": [
    "<font style=\"color:green;font-weight:bold\">例句:</font><br>① <font style=\"color:#000000\">It is worth the endeavor. </font><br><font style=\"color:#000000\"><u>值得尝试。</u></font> <font style=\"color:#808080\">(2018英语二完型)</font><br>② <font style=\"color:#000000\">Good governance rests on an understanding of the inherentworth of each individual.</font><br><font style=\"color:#000000\"><u>善治在于把握每个人的内在价值。</u></font> <font style=\"color:#808080\">(2017英语一阅读)</font><br>"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "pursuant-appreciation",
   "metadata": {},
   "source": [
    "## 派生"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "signed-welding",
   "metadata": {},
   "source": [
    "<font style=\"color:green;font-weight:bold\">派生:</font><br>① <font style=\"color:green;font-weight:bold\">unionize</font> <font style=\"color:#808080\">[ˈjuːniənaɪz]</font>❶ <font style=\"color:#000000;font-weight:bold\">v.组织工会;(使)加入工会</font>❷ <font style=\"color:#000000;font-weight:bold\">v.组织工会;(使)加入工会</font><br>② <font style=\"color:green;font-weight:bold\">unionize</font> <font style=\"color:#808080\">[ˈjuːniənaɪz]</font>❶ <font style=\"color:#000000;font-weight:bold\">v.组织工会;(使)加入工会</font>❷ <font style=\"color:#000000;font-weight:bold\">v.组织工会;(使)加入工会</font><br>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "given-listening",
   "metadata": {},
   "outputs": [],
   "source": [
    "def get_html_other_from_other_sx_derives_list(derives_list):\n",
    "    temp_derives_list = derives_list\n",
    "    \n",
    "    bq_num_1 = '❶❷❸❹❺❻❼❽❾❿⓫⓬⓭⓮⓯⓰⓱⓲⓳⓴'\n",
    "    bq_num_2 = '①②③④⑤⑥⑦⑧⑨⑩⑪⑫⑬⑭⑮⑯⑰⑱⑲⑳'\n",
    "    \n",
    "    # 标题\n",
    "    html_str = '<font style=\"color:green;font-weight:bold\">派生:</font><br>'\n",
    "    \n",
    "    temp_derives_list_len = len(temp_derives_list)\n",
    "    for i in range(temp_derives_list_len):\n",
    "        # 序号\n",
    "        html_str += bq_num_2[i]\n",
    "        # 单词\n",
    "        html_str += ' <font style=\"color:green;font-weight:bold\">'\n",
    "        html_str += temp_derives_list[i][0]\n",
    "        # 音标列表\n",
    "        html_str += '</font>'\n",
    "        enSymbols_list = temp_derives_list[i][1]\n",
    "        enSymbols_list_len = len(enSymbols_list)\n",
    "        for p in range(enSymbols_list_len):\n",
    "            html_str += ' <font style=\"color:#808080\">'\n",
    "            html_str += enSymbols_list[p]\n",
    "            html_str += '</font> '\n",
    "        \n",
    "        \n",
    "        # 意思列表\n",
    "        # 序号\n",
    "        means_list = temp_derives_list[i][2]\n",
    "        means_list_len = len(means_list)\n",
    "        for p in range(means_list_len):\n",
    "            html_str += bq_num_1[p]\n",
    "            html_str += ' <font style=\"color:#000000;font-weight:bold\">'\n",
    "            html_str += means_list[p]\n",
    "            html_str += '</font> '\n",
    "            if p==means_list_len-1:\n",
    "                html_str += '<br>'\n",
    "\n",
    "    return html_str"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "mexican-microphone",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'<font style=\"color:green;font-weight:bold\">派生:</font><br>① <font style=\"color:green;font-weight:bold\">mortality</font> <font style=\"color:#808080\">[mɔːˈtæləti]</font> ❶ <font style=\"color:#000000;font-weight:bold\">n. 死亡人数；死亡率；生命的有限性</font> <br>② <font style=\"color:green;font-weight:bold\">immortal</font> <font style=\"color:#808080\">[ɪˈmɔːtl]</font> ❶ <font style=\"color:#000000;font-weight:bold\">n. 神仙，永生者；不朽的人物</font> ❷ <font style=\"color:#000000;font-weight:bold\">adj. 永生的；不朽的</font> <br>'"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "get_html_other_from_other_sx_derives_list(zong_data_json[\"mortal\"][\"other_sx\"][\"derives_list\"])"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "played-holder",
   "metadata": {},
   "source": [
    "<font style=\"color:green;font-weight:bold\">派生:</font><br>① <font style=\"color:green;font-weight:bold\">mortality</font> <font style=\"color:#808080\">[mɔːˈtæləti]</font> ❶ <font style=\"color:#000000;font-weight:bold\">n. 死亡人数；死亡率；生命的有限性</font> <br>② <font style=\"color:green;font-weight:bold\">immortal</font> <font style=\"color:#808080\">[ɪˈmɔːtl]</font> ❶ <font style=\"color:#000000;font-weight:bold\">n. 神仙，永生者；不朽的人物</font> ❷ <font style=\"color:#000000;font-weight:bold\">adj. 永生的；不朽的</font> <br>"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "familiar-intersection",
   "metadata": {},
   "source": [
    "## 拓展 (单词类)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "honest-dutch",
   "metadata": {},
   "source": [
    "<font style=\"color:green;font-weight:bold\">拓展:</font><br><font style=\"color:#000000\">欧盟，全称欧洲联盟，是根据1993年生效的《马斯特里赫特条约》(Maastricht Treaty)所建立的政治经济联盟，现有成员国28个，官方语言24种。政治上，欧盟的所有成员国均为议会民主国家;经济上,欧盟是以德国、法国为核心成员国的世界第一大经济实体;军事上,欧盟成员国多为北大西洋公约组织(NorthAtlantic Treaty Organization，简称NATO)成员。</font><br>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "relevant-composition",
   "metadata": {},
   "outputs": [],
   "source": [
    "def get_html_other_from_other_sx_expands_list_word(expands_list):\n",
    "    temp_expands_list = expands_list\n",
    "\n",
    "    bq_num_1 = '❶❷❸❹❺❻❼❽❾❿⓫⓬⓭⓮⓯⓰⓱⓲⓳⓴'\n",
    "    bq_num_2 = '①②③④⑤⑥⑦⑧⑨⑩⑪⑫⑬⑭⑮⑯⑰⑱⑲⑳'\n",
    "    \n",
    "    # 标题\n",
    "    html_str = '<font style=\"color:green;font-weight:bold\">拓展:</font><br>'\n",
    "    \n",
    "    temp_expands_list_len = len(temp_expands_list)\n",
    "    for i in range(temp_expands_list_len):\n",
    "        # 序号\n",
    "        html_str += bq_num_2[i]\n",
    "        # 单词\n",
    "        html_str += ' <font style=\"color:green;font-weight:bold\">'\n",
    "        html_str += temp_expands_list[i][0]\n",
    "        # 音标列表\n",
    "        html_str += '</font>'\n",
    "        enSymbols_list = temp_expands_list[i][1]\n",
    "        enSymbols_list_len = len(enSymbols_list)\n",
    "        for p in range(enSymbols_list_len):\n",
    "            html_str += ' <font style=\"color:#808080\">'\n",
    "            html_str += enSymbols_list[p]\n",
    "            html_str += '</font> '\n",
    "        \n",
    "        \n",
    "        # 意思列表\n",
    "        # 序号\n",
    "        means_list = temp_expands_list[i][2]\n",
    "        means_list_len = len(means_list)\n",
    "        for p in range(means_list_len):\n",
    "            html_str += bq_num_1[p]\n",
    "            html_str += ' <font style=\"color:#000000;font-weight:bold\">'\n",
    "            html_str += means_list[p]\n",
    "            html_str += '</font> '\n",
    "            if p==means_list_len-1:\n",
    "                html_str += '<br>'\n",
    "\n",
    "    return html_str"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "ordered-mambo",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'<font style=\"color:green;font-weight:bold\">拓展:</font><br>① <font style=\"color:green;font-weight:bold\">army</font> <font style=\"color:#808080\">[ˈɑːmi]</font> ❶ <font style=\"color:#000000;font-weight:bold\">n. 陆军；[an~of]大群，大批</font> <br>② <font style=\"color:green;font-weight:bold\">navy</font> <font style=\"color:#808080\">[ˈneɪvi]</font> ❶ <font style=\"color:#000000;font-weight:bold\">n. 海军；藏青色air force 空军</font> <br>'"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "get_html_other_from_other_sx_expands_list_word(zong_data_json[\"military\"][\"other_sx\"][\"expands_list\"])"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "driving-symphony",
   "metadata": {},
   "source": [
    "<font style=\"color:green;font-weight:bold\">拓展:</font><br>① <font style=\"color:green;font-weight:bold\">army</font> <font style=\"color:#808080\">[ˈɑːmi]</font> ❶ <font style=\"color:#000000;font-weight:bold\">n. 陆军；[an~of]大群，大批</font> <br>② <font style=\"color:green;font-weight:bold\">navy</font> <font style=\"color:#808080\">[ˈneɪvi]</font> ❶ <font style=\"color:#000000;font-weight:bold\">n. 海军；藏青色air force 空军</font> <br>"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "casual-season",
   "metadata": {},
   "source": [
    "## 拓展 (短文类)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "gothic-allocation",
   "metadata": {},
   "source": [
    "<font style=\"color:green;font-weight:bold\">拓展:</font><br><font style=\"color:#000000\">欧盟，全称欧洲联盟，是根据1993年生效的《马斯特里赫特条约》(Maastricht Treaty)所建立的政治经济联盟，现有成员国28个，官方语言24种。政治上，欧盟的所有成员国均为议会民主国家;经济上,欧盟是以德国、法国为核心成员国的世界第一大经济实体;军事上,欧盟成员国多为北大西洋公约组织(NorthAtlantic Treaty Organization，简称NATO)成员。</font><br>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "canadian-settle",
   "metadata": {},
   "outputs": [],
   "source": [
    "def get_html_other_from_other_sx_expands_list_essay(expands_list):\n",
    "    temp_expands_list = expands_list\n",
    "        \n",
    "    # 标题\n",
    "    html_str = '<font style=\"color:green;font-weight:bold\">拓展:</font><br><font style=\"color:#000000\">'\n",
    "    \n",
    "    html_str += temp_expands_list[0]\n",
    "    html_str += '</font><br>'\n",
    "    \n",
    "    return html_str"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "scientific-burning",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'<font style=\"color:green;font-weight:bold\">拓展:</font><br><font style=\"color:#000000\">欧盟，全称欧洲联盟，是根据1993年生效的《马斯特里赫特条约》(Maastricht Treaty)所建立的政治经济联盟，现有成员国28个，官方语言24种。政治上，欧盟的所有成员国均为议会民主国家；经济上，欧盟是以德国、法国为核心成员国的世界第一大经济实体；军事上，欧盟成员国多为北大西洋公约组织(NorthAtlantic Treaty Organization，简称NATO)成员。</font><br>'"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "get_html_other_from_other_sx_expands_list_essay(zong_data_json[\"union\"][\"other_sx\"][\"expands_list\"])"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "demanding-cholesterol",
   "metadata": {},
   "source": [
    "<font style=\"color:green;font-weight:bold\">拓展:</font><br><font style=\"color:#000000\">欧盟，全称欧洲联盟，是根据1993年生效的《马斯特里赫特条约》(Maastricht Treaty)所建立的政治经济联盟，现有成员国28个，官方语言24种。政治上，欧盟的所有成员国均为议会民主国家；经济上，欧盟是以德国、法国为核心成员国的世界第一大经济实体；军事上，欧盟成员国多为北大西洋公约组织(NorthAtlantic Treaty Organization，简称NATO)成员。</font><br>"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "professional-story",
   "metadata": {},
   "source": [
    "## 下标"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "local-stamp",
   "metadata": {},
   "source": [
    "<br><font style=\"color:green;background-color:#A4E3BD;font-weight:bold\">词群逻辑：政权、体制相关</font><br><font style=\"color:green\">CHAPTER 01 政法_UNIT 01 政治</font>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "variable-genre",
   "metadata": {},
   "outputs": [],
   "source": [
    "def get_word_page_map():\n",
    "    \n",
    "    data_map = {}\n",
    "    \n",
    "    with open(\"./word_page_num.csv\",\"r\",encoding='utf-8') as f:\n",
    "        for i in f.readlines():\n",
    "            temp_i = i\n",
    "            temp_i_word_name = temp_i.split(\",\")[0]            \n",
    "            temp_i_word_page = temp_i.split(\",\")[1].split('\\n')[0]\n",
    "            data_map[temp_i_word_name] = temp_i_word_page\n",
    "\n",
    "    return data_map"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "genuine-catalog",
   "metadata": {},
   "outputs": [],
   "source": [
    "def get_html_foot_from_main_sx(main_sx,word_page_map):\n",
    "    temp_main_sx = main_sx\n",
    "    \n",
    "    group_list = ['{:0>3} 词群逻辑：暂无，未添加'.format(i+1) for i in range(208)]\n",
    "    util_list = [\"政治\",\"法律\",\"金融\",\"商业\",\"民生\",\"群体\",\"职业\",\n",
    "                 \"人际\",\"情感\",\"事态事件\",\"宗教民俗\",\"教育\",\"文艺\",\"语言\",\n",
    "                 \"传媒\",\"工业科技\",\"信息技术\",\"自然\",\"气候\",\"环保\",\"饮食\",\n",
    "                 \"居家\",\"休闲\",\"出行\",\"医疗保健\",\"疾病\",\"运动\",\"军事\",\n",
    "                 \"战争\",\"行为\",\"动作\",\"抽象\",\"现象\",\"态度\",\"观点\",\"逻辑\",\n",
    "                 \"变化\",\"状态\",\"形态\",\"品质\",\"特征\",\"程度\",\"范围\",\"数量\",\n",
    "                 \"方位\",\"地点\",\"时间\"]\n",
    "    chapter_list = [\"政法\",\"财经\",\"社会\",\"人文\",\"科技\",\"环境\",\"日常\",\"健康\",\"军事\",\"通用\"]\n",
    "    \n",
    "    # 标题\n",
    "    html_str = '<br><font style=\"color:green;background-color:#A4E3BD;font-weight:bold\">'\n",
    "    \n",
    "    html_str += group_list[int(main_sx['groupId'])-1]\n",
    "    \n",
    "    html_str += '</font><br><font style=\"color:green\">chapter '\n",
    "    html_str += '{:0>2} '.format(main_sx['chapterId'])\n",
    "    html_str += chapter_list[int(main_sx['chapterId'])-1]\n",
    "    \n",
    "    html_str += '-unit '\n",
    "    html_str += '{:0>2} '.format(main_sx['unitId'])\n",
    "    html_str += util_list[int(main_sx['unitId'])-1]\n",
    "    \n",
    "    \n",
    "    html_str += '</font>'\n",
    "    \n",
    "    # 添加书本目录索引\n",
    "    try:\n",
    "        wordName = temp_main_sx[\"wordName\"]\n",
    "        temp_word_page = word_page_map[wordName]\n",
    "        html_str += '<font style=\"color:green\">-P'\n",
    "        html_str += '{:0>3}'.format(temp_word_page)\n",
    "        html_str += '</font>'\n",
    "    except:\n",
    "        pass\n",
    "    \n",
    "    return html_str"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "frequent-panel",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'<br><font style=\"color:green;background-color:#A4E3BD;font-weight:bold\">053 词群逻辑：暂无，未添加</font><br><font style=\"color:green\">chapter 03 社会-unit 09 情感</font><font style=\"color:green\">-P095</font>'"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "word_page_map = get_word_page_map()\n",
    "get_html_foot_from_main_sx(zong_data_json[\"agitate\"][\"main_sx\"],word_page_map)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "growing-player",
   "metadata": {},
   "source": [
    "<br><font style=\"color:green;background-color:#A4E3BD;font-weight:bold\">053 词群逻辑：暂无，未添加</font><br><font style=\"color:green\">chapter 03 社会-unit 09 情感</font><font style=\"color:green\">-P095</font>"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "varied-qatar",
   "metadata": {},
   "source": [
    "## 记忆方法"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "verbal-speaking",
   "metadata": {},
   "source": [
    "<font style=\"color:green;font-weight:bold\">记忆:</font><br>① <font style=\"font-weight:bold\">ado</font><font style=\"font-weight:bold\"> => </font><font>adult 成年人</font><br>② <font style=\"font-weight:bold\">les</font><font style=\"font-weight:bold\"> => </font><font>less 少</font><br>③ <font style=\"font-weight:bold\">ent</font><font style=\"font-weight:bold\"> => </font><font>名词后缀，表示人/形容词后缀</font><br>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "ambient-mother",
   "metadata": {},
   "outputs": [],
   "source": [
    "def get_html_other_from_other_sx_mnemonics_list(mnemonics_list):\n",
    "    temp_mnemonics_list = mnemonics_list\n",
    "    \n",
    "    bq_num_2 = '①②③④⑤⑥⑦⑧⑨⑩⑪⑫⑬⑭⑮⑯⑰⑱⑲⑳'\n",
    "    \n",
    "    # 标题\n",
    "    html_str = '<font style=\"color:green;font-weight:bold\">记忆:</font><br>'\n",
    "    \n",
    "    temp_mnemonics_list_len = len(temp_mnemonics_list)\n",
    "    for i in range(temp_mnemonics_list_len):\n",
    "        # 序号\n",
    "        html_str += bq_num_2[i]\n",
    "        \n",
    "        html_str += ' <font style=\"font-weight:bold\">'\n",
    "        html_str += temp_mnemonics_list[i][0]\n",
    "        \n",
    "        html_str += '</font><font style=\"font-weight:bold\"> => </font><font>'\n",
    "        html_str += temp_mnemonics_list[i][1]\n",
    "        \n",
    "        html_str += '</font><br>'\n",
    "        \n",
    "    return html_str"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "destroyed-pound",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'<font style=\"color:green;font-weight:bold\">记忆:</font><br>① <font style=\"font-weight:bold\">ad</font><font style=\"font-weight:bold\"> => </font><font>前缀：表强调</font><br>② <font style=\"font-weight:bold\">opt</font><font style=\"font-weight:bold\"> => </font><font>option，选择-选择了某人/物-收养/采纳</font><br>'"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "get_html_other_from_other_sx_mnemonics_list(zong_data_json[\"adopt\"][\"other_sx\"][\"mnemonics_list\"])"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "received-experience",
   "metadata": {},
   "source": [
    "<font style=\"color:green;font-weight:bold\">记忆:</font><br>② <font style=\"font-weight:bold\">ad</font><font style=\"font-weight:bold\"> => </font><font>前缀：表强调</font><br>② <font style=\"font-weight:bold\">opt</font><font style=\"font-weight:bold\"> => </font><font>option，选择-选择了某人/物-收养/采纳</font><br>"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "front-joyce",
   "metadata": {},
   "source": [
    "## 编写导出拼接逻辑"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "disabled-second",
   "metadata": {},
   "outputs": [],
   "source": [
    "zong_data_json = get_json_data_from_file_name(\"zong_data_json_utf8.json\")\n",
    "word_name_list = zong_data_json.keys()\n",
    "word_page_map = get_word_page_map()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "satisfied-hierarchy",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(zong_data_json[\"address\"][\"other_sx\"][\"expands_list\"])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "restricted-regard",
   "metadata": {},
   "outputs": [],
   "source": [
    "txt_lines_list =[]\n",
    "for i in word_name_list:\n",
    "    temp_word_str = i+\"@\"\n",
    "    \n",
    "    temp_word_str += get_html_main_from_main_sx(zong_data_json[i][\"main_sx\"])\n",
    "    \n",
    "    other_sx_list = zong_data_json[i][\"other_sx\"].keys()\n",
    "    \n",
    "    if \"mnemonics_list\" in other_sx_list:\n",
    "        temp_word_str += get_html_other_from_other_sx_mnemonics_list(zong_data_json[i][\"other_sx\"][\"mnemonics_list\"])\n",
    "        \n",
    "    if \"exams_list\" in other_sx_list:\n",
    "        temp_word_str += get_html_other_from_other_sx_exams_list(zong_data_json[i][\"other_sx\"][\"exams_list\"])\n",
    "        \n",
    "    if \"examples_list\" in other_sx_list:\n",
    "        temp_word_str += get_html_other_from_other_sx_examples_list(zong_data_json[i][\"other_sx\"][\"examples_list\"])\n",
    "        \n",
    "    if \"derives_list\" in other_sx_list:\n",
    "        temp_word_str += get_html_other_from_other_sx_derives_list(zong_data_json[i][\"other_sx\"][\"derives_list\"])\n",
    "        \n",
    "    if \"expands_list\" in other_sx_list:\n",
    "        # 扩展知识的，就一条\n",
    "        if len(zong_data_json[i][\"other_sx\"][\"expands_list\"][0])!=3:\n",
    "            temp_word_str += get_html_other_from_other_sx_expands_list_essay(zong_data_json[i][\"other_sx\"][\"expands_list\"])\n",
    "        else:\n",
    "            # 扩展单词的\n",
    "            temp_word_str += get_html_other_from_other_sx_expands_list_word(zong_data_json[i][\"other_sx\"][\"expands_list\"])\n",
    "\n",
    "    temp_word_str += get_html_foot_from_main_sx(zong_data_json[i][\"main_sx\"],word_page_map)\n",
    "    \n",
    "    txt_lines_list.append(temp_word_str)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "filled-rapid",
   "metadata": {},
   "outputs": [],
   "source": [
    "with open(\"词汇的逻辑.txt\",\"w\",encoding=\"utf-8\") as f:\n",
    "    for i in txt_lines_list:\n",
    "        f.write(i)\n",
    "        f.write(\"\\n\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "registered-overview",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
